package com.accp.vehiclecare.action.syhaction;

import com.accp.vehiclecare.biz.syhbiz.RbprojectBiz;
import com.accp.vehiclecare.pojo.Rbproject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("api/rb")
public class RbprojectAction {

    @Autowired
    private RbprojectBiz biz;

    @GetMapping
    private List<Rbproject> query(String billNo){
        return biz.queryRbproject(billNo);
    }

    @PostMapping("/addr")
    private Map<String,Object> addRbproject(@RequestBody Rbproject rbproject){
        Map<String,Object> m = new HashMap<>();
        if (biz.addRbproject(rbproject)){
            m.put("code",200);
            m.put("msg","ok");
        }else {
            m.put("code",500);
            m.put("msg","on");
        }

        return m;
    }

    @DeleteMapping("delxm")
    private Map<String,Object> remove(int id){
        Map<String,Object> m = new HashMap<>();
        biz.removeXm(id);
        m.put("code",200);
        m.put("msg","ok");
        return m;
    }
}
